/*
 * CS575 Software Design
 * Group 6
 * Group Members: Anthony Davidson, Kendra Scheesley, Lyndsey Whitman, Stephen Zakrewsky
 * Date: May 19, 2012
 * Main Author(s): Anthony Davidson
 */
package edu.drexel.cs575.a3.location;

import java.io.File;
import java.util.Scanner;

/**
 * Creates the locale information for the scale. Locale information is created
 * based on the contents of one or more configuration files.
 * 
 * @author anthony
 *
 */
class LocaleProvider
{
	private static final String LOCALE = ".locale";
	private static LocaleProvider instance = new LocaleProvider();
	private LocaleEnum localeEnum;
	
	private LocaleProvider() {
		try
		{
			Scanner scanner = new Scanner(new File(LOCALE));
			
			this.localeEnum = LocaleEnum.valueOf(scanner.nextLine());
			
		}
		catch (Exception e)
		{
			throw new IllegalStateException("Error loading locale", e);
		}
	}
	
	public static LocaleProvider getInstance() {
		return instance;
	}
	
	public LocaleEnum getLocaleEnum() {
		return this.localeEnum;
	}
}
